博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
完成个人中心—导航标签
阅读量:7051 次
发布时间:2019-06-28

本文共 1170 字,大约阅读时间需要 3 分钟。

个人中心—视图函数带标签页面参数tag

@app.route('/usercenter/<user_id>/<tag>')
def usercenter(user_id, tag):
   if tag == ‘1':
       return render_template('usercenter1.html', **context)

@app.route('/usercenter/
/
')@loginFirstdef usercenter(user_id,tag): user = User.query.filter(User.id == user_id).first() context = { 'username':user.username, 'questions':user.questions, 'comments':user.comments } if tag =='question': return render_template('user question.html',**context) elif tag =='comment': return render_template('user comment.html', **context) else: return render_template('user information.html', **context)

个人中心—导航标签链接增加tag参数

<li role=“presentation”><a href=“{
{ url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">全部问答</a></li>

个人中心—有链接到个人中心页面的url增加tag参数

u <a href="{
{ url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{
{ session.get('user') }}</a>

 

转载于:https://www.cnblogs.com/951111ldj/p/8042607.html

你可能感兴趣的文章
ant工具的使用和功能
查看>>
Linux 常用系统工具与初始化配置
查看>>
31、C#里面的图片框PictureBox的使用
查看>>
CCNP学习笔记9——OSPF
查看>>
Java applet 安全性探究
查看>>
nocloud开发随记-2011-11-20
查看>>
Linux系统编程 --- 共享内存及内存映射【十全十美】
查看>>
如何创建一个swap文件
查看>>
mysql联合索引
查看>>
linux文本操作之---sed
查看>>
htmlcleaner 使用示例
查看>>
XenServer中创建多块网卡的绑定
查看>>
我的友情链接
查看>>
hystrix 源码分析--线程隔离
查看>>
我的友情链接
查看>>
经典24点算法大全
查看>>
nexus3 maven配置文件
查看>>
php使用nusoap创建WebService
查看>>
仿淘宝的滚动效果
查看>>
SQL2005开启远程连接功能
查看>>